package com.atguigu.fruit.service.impl;

import com.atguigu.fruit.dao.FruitDAO;
import com.atguigu.fruit.dao.impl.FruitDAOImpl;
import com.atguigu.fruit.pojo.Fruit;
import com.atguigu.fruit.service.fruitService;
import com.atguigu.myssm.basedao.ConnUtils;

import java.util.List;

public class fruitServiceimpl implements fruitService {

    private FruitDAO fruitDAO = null;

    @Override
    public List<Fruit> getFruitList(String keyword, Integer pageNo) {
        System.out.println("getFruitList"+ ConnUtils.getConn());
        return fruitDAO.getFruitList(keyword,pageNo);
    }

    @Override
    public Fruit getFruitbyFid(int fid) {
        return fruitDAO.getFruitbyFid(fid);
    }

    @Override
    public void update(Fruit fruit) {
        fruitDAO.update(fruit);

    }

    @Override
    public void addFruit(Fruit fruit) {

        fruitDAO.addFruit(fruit);
//        Fruit fruit2 = fruitDAO.getFruitbyFid(5);
//        fruit2.setFcount(99);
//        fruitDAO.update(fruit2);
    }

    @Override
    public void delFruit(Integer fid) {
        fruitDAO.delFruit(fid);
    }

    @Override
    public int countFruit(String keyword) {

        System.out.println("getCountFruit"+ ConnUtils.getConn());
        return fruitDAO.countFruit(keyword);
    }

    @Override
    public List<Fruit> getFruitSearch(String keyword) {
        return fruitDAO.getFruitSearch(keyword);
    }
}
